package api_day04;

public class TestDemo {
    public static void main(String[] args) {
        //顺序存储结构(数组)实现集合功能测试过程
        /*MyArrayList my = new MyArrayList(5);
        my.add("1");
        my.add("2");
        my.add("3");
        my.add("4");
        my.add("5");
        System.out.println(my);
        my.insert(2,"10");
        System.out.println(my);
        Object r = my.replace(5, "9");
        System.out.println(r);
        System.out.println(my);
        Object g = my.get(5);
        System.out.println(g);
        Object rem = my.remove(2);
        System.out.println(rem);
        System.out.println(my);
        my.add("2");
        my.remove("2");
        System.out.println(my);
        if (my.contain("2")){
            System.out.println(2);
        }
        if (my.isEmpty()) System.out.println(0);
        else System.out.println(1);*/
        //链式存储结构实现集合功能测试过程
        MyLinkedList my = new MyLinkedList();
        my.add("1");
        my.add("1");
        my.add("2");
        my.add("3");
        my.add("1");
        my.add("5");
        System.out.println(my);
        my.insert(5,"4");
        System.out.println(my);
        Object g = my.get(6);
        System.out.println(g);
        Object r = my.replace(6,"10");
        System.out.println(r);
        System.out.println(my);
        my.remove(0);
        System.out.println(my);
        my.remove("1");
        System.out.println(my);
        int s = my.size();
        System.out.println(s);
        if (my.contain("3")) System.out.println(3);
        if (my.isEmpty()) System.out.println(0);
        else System.out.println(1);
    }
}